limsLocationBoard.boardKSHDetailPage = {

    getBtnToolbar: function () {
        var _this = this
        return {
            type: 'btnToolbar',
            items: [{
                type: 'button',
                text: 'GIKAM.BUTTON.BACK',
                icon: 'back',
                onClick: function () {
                    workspace.window.goBack()
                }
            },]
        }
    },

    createPage: function () {
        let _this = this
        Gikam.create('layout', {
            center: {
                items: [this.getBtnToolbar(), {
                    type: 'iframe',
                    src: '/static/basemodule/samplemanage/board/index.html',
                    id: 'ksh-location-board-iframe',
                    onRendered: function (frame){
                        Gikam.postSync(limsLocationBoard.holeUrl + '/queries', Gikam.getJsonWrapper({
                            f: {
                                boardId_EQ: _this.param.id
                            },
                            o: [{
                                y : 'asc'
                            },{
                                x : 'asc'
                            }],
                            n: -1, s: -1
                        })).done(function (data) {
                            const  iframDom=document.querySelector("#ksh-location-board-iframe >iframe");
                            var flag=false;  //是否初次加载

                            iframDom.onload=function(){
                                flag =true;
                                iframDom.contentWindow.postMessage(data.rows, "*");
                            };
                            if(!flag){
                                iframDom.contentWindow.postMessage(data.rows, "*");
                            }
                        });
                    }
                }]
            },
            toolbarAlign: 'right',
            renderTo: workspace.window.$dom
        });
        return this;
    },

    init: function (param) {
        this.param = param;
        this.createPage();
    }
}
